const chalk =require('chalk');
const {readFilePromise, writeFilePromise} = require('./util/util');
const {textToCssAST,cssASTToText} =require('./cssAST');
const {cssASObjectSort} =require('./cssASTSort');

const formatCssFile = async function ({fileInputPath,fileOutputPath}) {
    const text = (await readFilePromise(fileInputPath)).toString();
    const styleSheetUnit3 = cssASObjectSort(textToCssAST(text));
    console.error(67,JSON.stringify(styleSheetUnit3))
    writeFilePromise(fileOutputPath, cssASTToText(styleSheetUnit3))
};

module.exports={
    formatCSS:formatCssFile
};
